local lsp_pokong = fk.CreateSkill {
    name = "lsp_pokong",
}

Fk:loadTranslationTable {
    ["lsp_pokong"] = "破空",
    [":lsp_pokong"] = "当有牌不因此技能移出游戏时，若你武将牌上的牌不大于体力值，你可以令一张手牌于本局游戏由你使用时，无次数和距离限制，然后将牌堆的底牌置入“棂韵”。",

    ["@@lsp_pokong"] = "破空",
}

lsp_pokong:addEffect(fk.AfterCardsMove, {
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(lsp_pokong.name) then
            for _, move in ipairs(data) do
                if move.toArea == Card.PlayerSpecial and move.skillName ~= "lsp_pokong" then
                    for _, info in ipairs(move.moveInfo) do
                        if info.fromArea ~= Card.PlayerSpecial then
                            local num = {}
                            for _, t in pairs(player.special_cards) do
                                table.insertTableIfNeed(num, t)
                            end
                            return true
                        end
                    end
                end
            end
        end
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player,
            { skill_name = lsp_pokong.name, prompt = "破空：请选择一张牌标记为“破空”牌，或点击取消。" })
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local num = {}
        for _, t in pairs(player.special_cards) do
            table.insertTableIfNeed(num, t)
        end
        if #num < player.hp then
            local card = player.room:askToCards(player, {
                min_num = 1,
                max_num = 1,
                include_equip = false,
                skill_name = lsp_pokong.name,
                prompt = "请选择一张手牌"
            })
            if #card == 0 then return false end
            room:setCardMark(Fk:getCardById(card[1]), "@@lsp_pokong", 1)
        end
        player:addToPile("lsp_lingyun", room:getNCards(1, "bottom")[1], true, lsp_pokong.name)
    end,
})

lsp_pokong:addEffect("targetmod", { --使用特定牌无次数和距离限制
    bypass_distances = function(self, player, skill, card, to)
        return card and player:hasSkill(lsp_pokong.name) and card:getMark("@@lsp_pokong") > 0
    end,
    bypass_times = function(self, player, skill, scope, card, to)
        return card and player:hasSkill(lsp_pokong.name) and card:getMark("@@lsp_pokong") > 0
    end,
})
return lsp_pokong
